﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using HousingInfo.Library;

namespace Admin.Admin
{
    public partial class News : System.Web.UI.Page
    {
       
        protected void Page_Load(object sender, EventArgs e)
        {
            //if ((Session["LOGIN"] == null) || (int)Session["ROLES"] != 1)
            //{
            //    Response.Redirect("Login.aspx");
            //}
            //string mode = Request.QueryString["Mode"];
            //btnApprove.Visible = false;
            //if (mode == "false")
            //{
            //    btnApprove.Visible = true;
            //    lbHeaderActions.Text = "Danh sách tin chưa duyệt";
            //    lbApprove.Text = "Duyệt tin";
            //}
        }

        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            //int newsboid = Convert.ToInt32(GridView1.SelectedRow.Cells[2].Text);
            //NewsBO newsbo = NewsBO.GetNewsBO(newsboid);
            //labelTitle.Text = newsbo.Title;
            //labelNoiDung.Text = newsbo.NewsContent;
            //labelLoaiNha.Text = newsbo.CategoryName;
            ////labelQuanHuyen.Text = newsbo.AreaName;
            //labelKhuVuc.Text = newsbo.AreaDetailName;
            //labelHuongNha.Text = newsbo.Direction;
            //labelGiayTo.Text = newsbo.Documents;
            //labelDienTich.Text = newsbo.SurfaceArea + " m2";
            //labelGia.Text = newsbo.Price + " " + newsbo.CurrencyName;
            //labelNgayDang.Text = newsbo.CreatedDate.ToString("dd/MM/yyyy");
            //labelNgayHet.Text = newsbo.ExpireDate.ToString("dd/MM/yyyy");

            //lbmessage.Text = "";
            //PanelActions.Visible = true;
           
        }

        protected void btnDel_Click(object sender, EventArgs e)
        {
            //int newsboid = Convert.ToInt32(GridView1.SelectedRow.Cells[2].Text);
            //try
            //{

            //    NewsBO.DeleteNewsBO(newsboid);
            //    GridView1.DataBind();
            //    PanelActions.Visible = false;
            //    lbmessage.Text = "Xóa thành công !";
            //}

            //catch
            //{
            //    lbmessage.Text = "Xóa thất bại !";
            //}
        }

        protected void btnApprove_Click(object sender, EventArgs e)
        {
            //try
            //{
            //    int newsboid = Convert.ToInt32(GridView1.SelectedRow.Cells[2].Text);
            //    NewsBO newsbo = NewsBO.GetNewsBO(newsboid);
            //    newsbo.IsActive = true;
            //    newsbo.Save();
            //    PanelActions.Visible = false;
            //    lbmessage.Text = "Đã duyệt !";
            //    GridView1.DataBind();
            //}

            //catch
            //{
            //    lbmessage.Text = "Duyệt không thành công !";
            //}
        }
    }
}
